home *** CD-ROM | disk | FTP | other *** search
- /* FILE: PStrDraw.c
- Draws 1 to 10 Pascal strings at specified locations in the
- current GrafPort. It Offers auto-centering and New-Line modes. */
- #include "PStrLib.h"
-
- PStrDraw(count, s, h, v)
- int count; /* number of { s, h, v} sets to follow */
- char *s; /* a pascal string to draw */
- int h; /* horizontal position */
- int v; /* vertical position */
- {
- register char *argPtr = (char *)&count;
- register char *sp;
- register Rect *rp = &thePort->portRect;
- register int x, y, lineHeight = 1.5 * thePort->txSize;
- static int old_x = 0, old_y = 0;
-
- if (count > 0) {
- while (--count >= 0) {
- sp = *(char **)(argPtr += 2);
- x = *(int *)(argPtr += 4);
- y = *(int *)(argPtr += 2);
- if (x >= 0)
- old_x = x;
- else if (x != CUR) /* Auto-Center Mode? */
- old_x = (rp->right - rp->left - StringWidth(sp)) / 2;
- if (y >= 0)
- old_y = y;
- else if (y != CUR) /* New-Line Mode? */
- old_y += -y * lineHeight;
- MoveTo(old_x, old_y);
- DrawString(sp);
- old_x += StringWidth(sp);
- }
- }
- }